Actually communicating with InSim is the easier part You listen for specific packets coming from LFS telling you about the current state of the car (speed, acceleration, position etc.) and then send other packets telling the AI car what to do (turn the wheel, accelerate, brake etc.) in regular intervals like every 100 ms.
I've got a very early prototype where I tell an AI car to drive at a constant speed using a PID controller:
I haven't worked much on the driving lessons layout, but I've got a server running called [WIP] City Bus Driving where I've started working on a traffic driving layout primarily suited for buses, with the help of a few other players.
For driving lessons style server, I suggest joining [RL] Real Life 1 where you have to take some driving lessons and take a test before you get a driving license.
Modelling proofs belong to a thread in the Work in Progress forum, which you then link in the mod submission form. I have moved this thread to the correct forum in the "Development thread URL / ID" field.
Thanks for posting this, I think he explains everything very well and in detail. I also recommend watching his videos on suspension where he talks about roll centre. This might be helpful for people building suspension for their mods.
InSim and OutSim are different protocols. OutSim packets will only be sent to the currently viewed car from cockpit view.
To set up OutSim, edit these lines in cfg.txt:
OutSim Mode 0 :0-off 1-driving 2-driving+replay OutSim Delay 1 :minimum delay between packets (100ths of a sec) OutSim IP 0.0.0.0 :IP address to send the UDP packet (127.0.0.1 for local host) OutSim Port 0 :IP port OutSim ID 0 :if not zero, adds an identifier to the packet OutSim Opts 0 : a hexadecimal number to send various OutSim data - see docs/OutSimPack.txt
Then the library you're using must support receiving OutSim data from a given port.
Maybe I'm wrong but that 1 second debounce time seems to be there to prevent exploits by creating scripts which would automatically adjust the brake balance in real time or very quickly based on the brake input, effectively giving an advantage over those who don't use it. Similarly, a clever program could analyze live OutSim data and adjust the them to counteract oversteer or understeer mid-corner.